import torch
from torch.autograd import Variable

x = torch.Tensor([[1, 2], [3, 4], [5, 6]])
# 开启反向传播的功能
x.requires_grad = True

y = torch.mean(x * x)  # v^2

# 进行误差反向传播
y.backward()
# 查看误差
print(x.grad)


